package cn.itlight.org.domain;

import cn.itlight.basic.domain.BaseDomain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;

/**
* @Description: TODO
* @Author: TomLiu
* @Version: 1.0
* @Date:  2022/6/21 18:43  
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Department extends BaseDomain {
   private Integer state;
   private String sn;
   private String name;
   private String dirPath;
   private Long managerId;
   private Long parentId;
   private Employee manager;
   private Department parent;
   // 封装子部门集合字段
   @JsonInclude(JsonInclude.Include.NON_EMPTY) // 当数据不为空的时候才返回
   private List<Department> children = new ArrayList<>();


   @Override
   public String toString() {
      return "Department{" +
              "id='" + getId() + '\'' +
              "sn='" + sn + '\'' +
              ", name='" + name + '\'' +
              ", dirPath='" + dirPath + '\'' +
              ", manager_id=" + managerId +
              ", parent_id=" + parentId +
              ", manager=" + manager +
              ", parent=" + parent +
              ", children=" + children +
              '}';
   }
}
